<template>
  <div>
    <div class="mydog">
      <img :src="ImgUrl" alt="" />
      <p class="center" :style="{ background: coloers }" @click="yellow">
        {{ Name }}
      </p>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      coloers: "",
    };
  },
  props: ["ImgUrl", "Name"],
  methods: {
    yellow() {
      this.coloers = `rgb(${Math.floor(Math.random() * 256)}, ${Math.floor(
        Math.random() * 256
      )}, ${Math.floor(Math.random() * 256)})`;
      this.$emit("like", this.Name);
    },
  },
};
</script>

<style>
.mydog {
  width: 300px;
  height: 300px;
  border: aqua 1px solid;
  float: left;
}
img {
  width: 200px;
  height: 200px;
  margin-left: 50px;
}
.center {
  width: 300px;
  height: 50px;
  text-align: center;
  line-height: 50px;
}
</style>